using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using deckAnalyser.Support;
using deckAnalyser.Domain;

namespace deckAnalyser.Forms
{
  public partial class DeckInfoForm : Form
  {
    public DeckInfoForm()
    {
      InitializeComponent();
    }

    private String deckName = "";
    public String DeckName
    {
      get { return deckName; }
      set { deckName = value; UpdateView(); }
    }

    private String author = "";
    public String Author
    {
      get { return author; }
      set { author = value; UpdateView(); }
    }

    private string notes = "";
    public String Notes
    {
      get { return notes; }
      set { notes = value; UpdateView(); }
    }


    private void UpdateView()
    {
      tbDeckName.Text = DeckName;
      tbAuthor.Text = Author;
      tbNotes.Text = Notes;

      if (String.IsNullOrEmpty(tbDeckName.Text) || String.IsNullOrEmpty(tbAuthor.Text))
        btnAction.Enabled = false;
      else
        btnAction.Enabled = true;
    }

    private void btnCancel_Click(object sender, EventArgs e)
    {
      DialogResult = DialogResult.Cancel;
      Close();
    }

    private void btnAction_Click(object sender, EventArgs e)
    {
      DialogResult = DialogResult.OK;
      Close();
    }

    private void tbDeckName_TextChanged(object sender, EventArgs e)
    {
      DeckName = tbDeckName.Text;
    }

    private void tbAuthor_TextChanged(object sender, EventArgs e)
    {
      Author = tbAuthor.Text;
    }

    private void tbNotes_TextChanged(object sender, EventArgs e)
    {
      Notes = tbNotes.Text;
    }
  }
}